In computer science, a virtual machine (VM) is a portion of software that, when executed on appropriate hardware, creates an environment allowing the virtualization of an actual physical computer system. Each VM may function as a self-contained platform, running its own operating system (OS) and software applications (processes). Typically, a virtual machine monitor (VMM) or hypervisor manages allocation and virtualization of computer resources, such as physical and virtual devices.
Frequently, a guest running on a virtual machine requires access to a device managed by the hypervisor. To gain the desired access, the guest specifies to the hypervisor which virtual or physical device or device function it wishes to access (i.e., the desired device) by providing a request for access to the device including address information associated with the desired device. Upon receipt of the device access request, the hypervisor decodes the device address information provided in the request in order to identify the desired device.
One conventional method for assigning and managing the device addresses associated with the multiple devices managed by a hypervisor involves a static assignment by the hypervisor of a fixed address to a particular device. However, this approach is inflexible, particularly when adding or removing devices from the system. Furthermore, this approach requires the hypervisor to maintain state information associated with the device in order to properly manage the access requests received from the guest. Maintenance of the device state information places an additional burden on the hypervisor, such as, for example, requiring the transfer of the maintained state information during the migration of a virtual machine (and guest) from one hypervisor to another.
Another conventional approach to device address assignment is for the guest to dynamically assign an address to the desired device. According to this approach, the guest sets the device address by an instruction that is trapped by the hypervisor. Then, a follow-up instruction from the guest includes the device address, which is used by the hypervisor to identify the desired device. Although this approach provides the guest with flexibility, by giving the guest the ability to designate a device address, the hypervisor is forced to manage device addresses having a variety of data structures (e.g., device addresses having a wide range of different data structure forms and formats). Due to the lack of uniformity in dynamic guest-assigned device addresses, device look-up and identification is an inefficient and time-consuming process.